package com.infnoon.consumer;

import com.infnoon.example.common.model.User;
import com.infnoon.example.common.service.UserService;
import com.infnoon.rpc.proxy.ServiceProxyFactory;

public class BaseConsumerExample {
    public static void main(String[] args) {

        // todo 需要获取 UserService 的实现类对象
        // 静态代理 : UserService userService = new UserServiceProxy(); ... 完成调用
        // 动态代理 :
        UserService userService = ServiceProxyFactory.getProxy(UserService.class);
        //UserService userService = null;
        User user = new User();
        user.setName("INFNOON");

        // 调用
        User newUser = userService.getUser(user);
        if (newUser != null) {
            System.out.println(newUser.getName());
        } else {
            System.out.println("user == null");
        }
    }
}
